import Vue from 'vue'
import Router from 'vue-router'
import test from '@/views/test.vue'
const Login = (resolve) => require(['@/views/login/login.vue'], resolve)
const addRouters = (resolve) => require(['@/views/testAddRouters/addRouters.vue'], resolve)
const foo = resolve => require(['@/views/testAddRouters/foo.vue'], resolve)
const canvas1 = resolve => require(['@/views/canvas/canvas1.vue'], resolve)
const tuiEditor = resolve => require(['@/views/markdown/tuiEditor.vue'], resolve)
const mavonEditor = resolve => require(['@/views/markdown/mavonEditor.vue'], resolve)

Vue.use(Router)

export const constantRouterMap  = [
  { path: '/login', component: Login, hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },
  { path: '/', name: '首页', component: test, redirect: '/test', children: [
    { path: 'test', component: test }
  ]},
  { path: '/canvas1', component: canvas1 },
  { path: '/tuiEditor', component: tuiEditor },
  { path: '/mavonEditor', component: mavonEditor }
]

export default new Router({
  routes: constantRouterMap
})

export const asyncRouterMap = [
  { path: '/addRouters', name: 'addRouters', component: addRouters },
  { path: '/foo', name: 'foo', component: foo },
  { path: '*', redirect: '/404', hidden: true }
]
